package com.touchwisdom.modular.common.system.user;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.springframework.context.annotation.Lazy;
import org.springframework.format.annotation.DateTimeFormat;

import com.touchwisdom.modular.common.entity.BaseEntity;
import com.touchwisdom.modular.common.types.SexType;
import com.touchwisdom.modular.util.config.YesNoType;

/**
 * @author 周恪竭
 */
@Entity
@Table(name = "T_USER")
@Lazy(value = false)
public class TUser extends BaseEntity {
	public static final String PROPERTY_USER_ID = "userId";
	public static final String PROPERTY_USER_NAME = "userName";
	public static final String PROPERTY_REAL_NAME = "realName";
	public static final String PROPERTY_USER_PASS = "userPass";
	public static final String PROPERTY_STATE = "state";
	public static final String PROPERTY_EMAIL = "email";
	public static final String PROPERTY_PHONE = "phone";
	public static final String PROPERTY_MOBILE = "mobile";
	@Column(length = 64)
	private String userName; // 用户姓名

	@Column(length = 64)
	private String userPass; // 密码

	@Column(length = 64)
	private String realName; // 真实名字

	@Column(length = 16)
	private String sex = SexType.MAN.name();// 性别

	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "M-")
	@Column(length = 5, nullable = true)
	private Date birthday; // 生日

	@Column(length = 16, nullable = true)
	private String phone; // 电话

	@Column(length = 16, nullable = true)
	private String mobile; // 手机

	@Column(length = 256, nullable = true)
	private String email; // 邮箱

	@Column(length = 256, nullable = true)
	private String avatar; // 头像信息

	@Column(length = 2048, nullable = true)
	private String interest; // 兴趣爱好

	@Column(length = 2048, nullable = true)
	private String remark; // 其他描述信息

	@Column(length = 8, nullable = true)
	private String state = YesNoType.Y.name();

	@Column(length = 5, nullable = false)
	private Integer secretLevel = 0;

	@Column(length = 5, nullable = false)
	private Integer age = 0;

	@Column(length = 32, nullable = true)
	private String idcard;

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Integer getSecretLevel() {
		return secretLevel;
	}

	public void setSecretLevel(Integer secretLevel) {
		this.secretLevel = secretLevel;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public String getIdcard() {
		return idcard;
	}

	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getUserPass() {
		return userPass;
	}

	public void setUserPass(String userPass) {
		this.userPass = userPass;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public String getInterest() {
		return interest;
	}

	public void setInterest(String interest) {
		this.interest = interest;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	private String position; // 职位

	@Column(length = 32, nullable = true)
	private String departmentId; // 部门

	@Transient
	private String departmentName; // 部门名称 (json) 查询使用

	@Transient
	public String getDepartmentName() {
		return departmentName;
	}

	@Transient
	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public String getDepartmentId() {
		return departmentId;
	}

	public void setDepartmentId(String departmentId) {
		this.departmentId = departmentId;
	}
}